package com.yida.gwj.expend.domain.request;

import java.util.List;

import com.yida.common.core.exception.ServiceException;
import com.yida.gwj.common.utils.GwjEnumUtils;
import com.yida.gwj.expend.domain.GwjMaintenanceFundsBusiness;
import com.yida.gwj.expend.domain.GwjMaintenanceFundsBusinessAttachment;
import com.yida.gwj.expend.domain.GwjMaintenanceFundsBusinessBuild;
import com.yida.gwj.expend.domain.GwjMaintenanceFundsBusinessCommunity;
import com.yida.gwj.expend.domain.GwjMaintenanceFundsBusinessHouse;
import com.yida.gwj.expend.domain.GwjMaintenanceFundsBusinessInfo;
import com.yida.gwj.expend.domain.GwjMaintenanceFundsBusinessOwner;
import com.yida.gwj.expend.enums.BusinessStatusEnum;
import com.yida.gwj.expend.enums.MaintenanceFundsErrorEnum;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 业务内容打包删除后新增
 *
 * @author liangp
 * @date 2023-02-08
 */

@ApiModel(description = "业务内容打包删除后新增")
public class BusinessDelete2SaveRequest {

    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "公维金资金申请业务信息")
    private GwjMaintenanceFundsBusiness maintenanceFundsBusiness;

    @ApiModelProperty(value = "公维金资金申请业务楼栋信息")
    private List<GwjMaintenanceFundsBusinessBuild> maintenanceFundsBusinessBuildList;

    @ApiModelProperty(value = "公维金资金申请业务社区信息")
    private GwjMaintenanceFundsBusinessCommunity maintenanceFundsBusinessCommunity;

    @ApiModelProperty(value = "公维金资金申请业务房屋信息")
    private List<GwjMaintenanceFundsBusinessHouse> maintenanceFundsBusinessHouseList;

    @ApiModelProperty(value = "公维金资金申请业务基础信息")
    private GwjMaintenanceFundsBusinessInfo maintenanceFundsBusinessInfo;

    @ApiModelProperty(value = "公维金资金申请业务业主信息")
    private List<GwjMaintenanceFundsBusinessOwner> maintenanceFundsBusinessOwnerList;

    @ApiModelProperty(value = "上传文件列表")
    private List<GwjMaintenanceFundsBusinessAttachment> maintenanceFundsBusinessAttachmentList;

    public List<GwjMaintenanceFundsBusinessAttachment> getMaintenanceFundsBusinessAttachmentList() {
        return maintenanceFundsBusinessAttachmentList;
    }

    public void setMaintenanceFundsBusinessAttachmentList(List<GwjMaintenanceFundsBusinessAttachment> maintenanceFundsBusinessAttachmentList) {
        this.maintenanceFundsBusinessAttachmentList = maintenanceFundsBusinessAttachmentList;
    }

    public GwjMaintenanceFundsBusiness getMaintenanceFundsBusiness() {
        return maintenanceFundsBusiness;
    }

    public void setMaintenanceFundsBusiness(GwjMaintenanceFundsBusiness maintenanceFundsBusiness) {
        this.maintenanceFundsBusiness = maintenanceFundsBusiness;
    }

    public List<GwjMaintenanceFundsBusinessBuild> getMaintenanceFundsBusinessBuildList() {
        return maintenanceFundsBusinessBuildList;
    }

    public void setMaintenanceFundsBusinessBuildList(List<GwjMaintenanceFundsBusinessBuild> maintenanceFundsBusinessBuildList) {
        this.maintenanceFundsBusinessBuildList = maintenanceFundsBusinessBuildList;
    }

    public GwjMaintenanceFundsBusinessCommunity getMaintenanceFundsBusinessCommunity() {
        return maintenanceFundsBusinessCommunity;
    }

    public void setMaintenanceFundsBusinessCommunity(GwjMaintenanceFundsBusinessCommunity maintenanceFundsBusinessCommunity) {
        this.maintenanceFundsBusinessCommunity = maintenanceFundsBusinessCommunity;
    }

    public List<GwjMaintenanceFundsBusinessHouse> getMaintenanceFundsBusinessHouseList() {
        return maintenanceFundsBusinessHouseList;
    }

    public void setMaintenanceFundsBusinessHouseList(List<GwjMaintenanceFundsBusinessHouse> maintenanceFundsBusinessHouseList) {
        this.maintenanceFundsBusinessHouseList = maintenanceFundsBusinessHouseList;
    }

    public GwjMaintenanceFundsBusinessInfo getMaintenanceFundsBusinessInfo() {
        return maintenanceFundsBusinessInfo;
    }

    public void setMaintenanceFundsBusinessInfo(GwjMaintenanceFundsBusinessInfo maintenanceFundsBusinessInfo) {
        this.maintenanceFundsBusinessInfo = maintenanceFundsBusinessInfo;
    }

    public List<GwjMaintenanceFundsBusinessOwner> getMaintenanceFundsBusinessOwnerList() {
        return maintenanceFundsBusinessOwnerList;
    }

    public void setMaintenanceFundsBusinessOwnerList(List<GwjMaintenanceFundsBusinessOwner> maintenanceFundsBusinessOwnerList) {
        this.maintenanceFundsBusinessOwnerList = maintenanceFundsBusinessOwnerList;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("SubmitIntranetRequest{");
        sb.append("maintenanceFundsBusiness=").append(maintenanceFundsBusiness);
        sb.append(", maintenanceFundsBusinessBuildList=").append(maintenanceFundsBusinessBuildList);
        sb.append(", maintenanceFundsBusinessCommunity=").append(maintenanceFundsBusinessCommunity);
        sb.append(", maintenanceFundsBusinessHouseList=").append(maintenanceFundsBusinessHouseList);
        sb.append(", maintenanceFundsBusinessInfo=").append(maintenanceFundsBusinessInfo);
        sb.append(", maintenanceFundsBusinessOwnerList=").append(maintenanceFundsBusinessOwnerList);
        sb.append('}');
        return sb.toString();
    }

    public void checkNull() {
        if (ObjectUtil.notEqual(maintenanceFundsBusiness.getStatus(), BusinessStatusEnum.SUBMIT.getCode())) {
            throw new ServiceException(GwjEnumUtils.getEnumConstantMsg(MaintenanceFundsErrorEnum.SUBMIT_INTRANET) + "业务状态不正确");
        }
        if (ObjectUtil.isNull(maintenanceFundsBusiness)) {
            throw new ServiceException(GwjEnumUtils.getEnumConstantMsg(MaintenanceFundsErrorEnum.SUBMIT_INTRANET) + "公维金资金申请业务信息不能空");
        }
        if (CollectionUtil.isEmpty(maintenanceFundsBusinessAttachmentList)) {
            throw new ServiceException(GwjEnumUtils.getEnumConstantMsg(MaintenanceFundsErrorEnum.SUBMIT_INTRANET) + "上传文件不能为空，请选择文件进行上传");
        }
        if (CollectionUtil.isEmpty(maintenanceFundsBusinessBuildList)) {
            throw new ServiceException(GwjEnumUtils.getEnumConstantMsg(MaintenanceFundsErrorEnum.SUBMIT_INTRANET) + "公维金资金申请业务楼栋信息不能为空");
        }
        if (ObjectUtil.isNull(maintenanceFundsBusinessCommunity)) {
            throw new ServiceException(GwjEnumUtils.getEnumConstantMsg(MaintenanceFundsErrorEnum.SUBMIT_INTRANET) + "公维金资金申请业务社区信息不能为空");
        }
        if (ObjectUtil.isNull(maintenanceFundsBusinessInfo)) {
            throw new ServiceException(GwjEnumUtils.getEnumConstantMsg(MaintenanceFundsErrorEnum.SUBMIT_INTRANET) + "公维金资金申请业务基础信息不能为空");
        }
        if (CollectionUtil.isEmpty(maintenanceFundsBusinessHouseList)) {
            throw new ServiceException(GwjEnumUtils.getEnumConstantMsg(MaintenanceFundsErrorEnum.SUBMIT_INTRANET) + "公维金资金申请业务房屋信息不能为空");
        }
        if (CollectionUtil.isEmpty(maintenanceFundsBusinessOwnerList)) {
            throw new ServiceException(GwjEnumUtils.getEnumConstantMsg(MaintenanceFundsErrorEnum.SUBMIT_INTRANET) + "公维金资金申请业务业主信息不能为空");
        }
    }

}
